import $dateFormat from "@q-admin-design-vue/utils/DateFormat"
export const searchForm = [
	{
		key: 'slotInterface'
	},
	{
		componentType: "text",
		key: "channelName",
		label: "渠道名称：",
	},
	{
		componentType: "select",
		key: "channelName1",
		label: "选择：",
		options: [{
			value: '1',
			label: '渠道名称1'
		}]
	},
	{
		componentType: "select-v2",
		key: "channelName2",
		label: "虚拟列表选择：",
		options: [{
			value: '2',
			label: '渠道名称2'
		}]
	},
	{
		componentType: "checkSelect",
		selectAll: true,
		key: "channelName3",
		label: "checkBox选择：",
		options: [{
			value: '3',
			label: '渠道名称3'
		}]
	},
	{
		componentType: "cascader",
		key: "channelName4",
		label: "级联选择：",
		options: [{
			value: '4',
			label: '渠道名称4',
			children: [
				{
					value: '4-1',
					label: '渠道名称4-1',
				},
				{
					value: '4-2',
					label: '渠道名称4-2',
					children: [{
						value: '4-2-1',
						label: '渠道名称4-2-1',
					}]
				}
			]
		}]
	},
	{
		componentType: "datePicker",
		type: 'year',
		key: "日期",
		label: "日期：",
	},
	{
		componentType: "datePicker",
		type: 'datetime',
		key: "日期时间",
		dateFormat: 'YYYY-MM-DD HH:mm:ss',
		label: "日期时间：",
	},
	{
		componentType: "dateRangPicker",
		type: 'daterange',
		key: "channelName7",
		label: "日期区间：",
		dateFormat: 'YYYY-MM-DD',
		valueFormat: 'x',
		defaultValue: [
			$dateFormat.dateTime(`${$dateFormat.subtractDay(29)}`),
			$dateFormat.dateTime(`${$dateFormat.subtractDay(0)}`),
		]
	},
	{
		componentType: "dateRangPicker",
		type: 'datetimerange',
		key: "channelName8",
		label: "日期时间区间：",
		dateFormat: 'YYYY-MM-DD HH:mm:ss',
		valueFormat: 'x',
		defaultValue: [
			$dateFormat.dateTime(`${$dateFormat.subtractDay(29)} 00:00:00`),
			$dateFormat.dateTime(`${$dateFormat.subtractDay(0)} 23:59:59`),
		]
	},

];

export const tableColumns = [
	{
		type: 'selection',
		align: "center",
		selectable: row => {
			return row.status === 'AT_PAS'
		}
	},
	{
		title: "序号",
		type: "index",
		align: "center",
		width: 60
	},
	// {
	// 	title: "图片",
	// 	field: "imageSrc",
	// 	align: "center",
	// 	preview: true
	// },
	{
		title: "备注",
		field: "remarkInfo",
		align: "center",
		overflowTooltipLimit: 4,
		width: 130
	},
	{
		title: "当前状态",
		field: "status",
		align: "center",
		width: 100,
		formatter: (value) => {
			return value === "DRAFT"
				? "待提审"
				: value === "W_AT"
					? "待审核"
					: value === "AT_RJT"
						? "驳回"
						: value === "AT_PAS"
							? "已完成"
							: value === "AT_CCL"
								? "审核撤销"
								: "-";
		}
	},
	{
		title: "名单导入时间",
		field: "exportDate",
		align: "center",
		width: 140,
		formatter: (value) => {
			return value ? $dateFormat.YYYYMMDDHHmmss(value, "-") : "-";
		}
	},
	{
		title: "执行内容",
		field: "busiCode",
		align: "center",
		width: 100,
		overflowTooltip: true,
	},
	{
		title: "实际执行时间",
		field: "submitDate",
		align: "center",
		width: 140,
		sortable: 'custom',
		formatter: (value) => {
			return value ? $dateFormat.YYYYMMDDHHmmss(value, "-") : "-";
		}
	},
	{
		title: "导入总条数",
		field: "nameNum",
		align: "center",
		width: 100
	},
	{
		title: "创建人",
		field: "submitPerson",
		align: "center",
		width: 100
	},
	{
		title: "审批人",
		field: "admitPerson",
		align: "center",
		width: 100
	}
];

// 全局按钮配置
export const globalOperate = [
	{
		butType: 'LOOK',
		name: "查看指标口径",
		type: "primary",
		text: true
	},
	{
		butType: 'BATCH',
		name: "批量",
		type: "primary",
		disabledRow: 7
	},
	{
		butType: "CUSTOM",
		name: "设置自定义列",
		type: "primary",
		align: "right"
	},
	{
		butType: 'CREATE',
		name: "新增",
		type: "primary",
		align: "right",
		permi: ['absm_admin_1', 'absm_admin_2']
	},
];
// 操作项按钮配置
export const operate = [
	{
		butType: 'PASS',
		type: 'primary',
		name: '通过',
		// permi: (row) => {
		// 	// console.log('row====', row)
		// 	return [`${row.auditRole}`]
		// },
		display: row => {
			return true
			// const { auditState } = row
			// return +auditState === 1 ? true : +auditState === 4 ? true : false
		}
	},
	{
		butType: 'REFUSE',
		type: 'danger',
		name: '拒绝',
		permi: (row) => {
			return ['absm_admin', `${row.auditRole}_1`]
		},
		display: row => {
			return true
			// const { auditState } = row
			// return +auditState === 1 ? true : +auditState === 4 ? true : false
		}
	},
	{
		butType: 'PASS1',
		type: 'primary',
		name: '通过1',
		permi: 'absm_admin_1',
		// display: row => {
		// 	return false
		// 	// const { auditState } = row
		// 	// return +auditState === 1 ? true : +auditState === 4 ? true : false
		// }
	},
	{
		butType: 'REFUSE1',
		type: 'warning',
		name: '拒绝1',
		permi: 'absm_admin'
	}
]
